package com.heima.feign.config;

import com.heima.feign.client.ApUserFeignClient;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.common.enums.AppHttpCodeEnum;
import com.heima.model.user.entity.ApUser;
import org.springframework.cloud.openfeign.FallbackFactory;

public class ApUserFallBackFactory implements FallbackFactory<ApUserFeignClient>{
    @Override
    public ApUserFeignClient create(Throwable cause) {
        return new ApUserFeignClient() {
            @Override
            public ResponseResult<ApUser> findById(Long id) {
                return ResponseResult.errorResult(AppHttpCodeEnum.SERVER_ERROR);
            }
        };
    }
}
